package cn.yunyichina.provider.reservation.service.impl;

import cn.yunyichina.provider.iface.entity.common.Response;
import cn.yunyichina.provider.reservation.dao.EnumDao;
import cn.yunyichina.provider.reservation.entity.Enum;
import cn.yunyichina.provider.reservation.service.EnumService;
import com.alibaba.fastjson.JSON;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Created by Lullaby on 2016/8/25.
 */
@Service
public class EnumServiceImpl implements EnumService {

    @Resource
    private EnumDao enumDao;

    public Response getEnum(String params) {
        Map<String, String> map = JSON.parseObject(params, Map.class);
        String enumCodes = map.get("enum_codes");
        List<Enum> enums = enumDao.getEnum(enumCodes.split(","));
        Response response = new Response();
        response.setResult(JSON.toJSONString(enums));
        return response;
    }

}
